package com.huike.web.controller.report;

import com.huike.business.domain.TbBusiness;
import com.huike.business.service.ITbBusinessService;
import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbDate;
import com.huike.clues.service.ITbClueService;
import com.huike.common.core.domain.AjaxResult;
import com.huike.contract.domain.TbContract;
import com.huike.contract.service.ITbContractService;
import com.huike.report.domain.vo.Cebc;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.controller.BaseController;

import java.util.Date;
import java.util.List;


@RestController
@RequestMapping("/report")
public class ReportController extends BaseController {
@Autowired
private ITbClueService iTbClueService;

@Autowired
private ITbBusinessService iTbBusinessService;

@Autowired
private ITbContractService iTbContractService;

    @GetMapping("/getVulnerabilityMap/{date1}/{date2}")
    public AjaxResult getVulner(@PathVariable("date1") String date1 , @PathVariable("date2") String date2){
        TbDate tbDate = new TbDate();
        tbDate.setBeginCreateTime(date1);
        tbDate.setEndCreateTime(date2);
        Integer i1 = iTbClueService.selectByCreateTime(tbDate);

        Integer i2 = iTbClueService.selectByCreateTimeStatus(tbDate);

        Integer i3 = iTbBusinessService.selectTbBusinessByCreateTime(tbDate);

        Integer i4 = iTbContractService.selectTbContractCreateTime(tbDate);

        Cebc cebc = new Cebc();
        cebc.setCluesNums(i1);
        cebc.setEffectiveCluesNums(i2);
        cebc.setBusinessNums(i3);
        cebc.setContractNums(i4);
        return AjaxResult.success(cebc);
    }
}